$.get(
  "https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json", // https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json
  function (cZjson) {
    echarts.registerMap("中华人民共和国", cZjson);
    var chartMidMap = echarts.init(document.getElementById("mid-map"));

    function mapFunc() {
        $.ajax({
            type: "post",
            url: baseUrl + "province/excessiveStatistics",
            success: function (data) {
                var list = []
                for (const v of data.data) {
                    list.push({name: v.pname, value: v.aqiNum})
                }
    
                optionMidMap = {
                    title: {
                      show: true,
                      text: "",
                      textStyle: {
                        color: "#83cadf", //'red'，字体颜色
                        fontStyle: "normal", //'italic'(倾斜) | 'oblique'(倾斜体) ，字体风格
                        fontWeight: "bold", //'bold'(粗体) | 'bolder'(粗体) | 'lighter'(正常粗细) ，字体粗细
                        fontFamily: "sans-serif", //'sans-serif' | 'serif' | 'monospace' | 'Arial' | 'Courier New'
                        // 'Microsoft YaHei'(微软雅黑) ，文字字体
                        fontSize: 24, //字体大小
                        lineHeight: 24, //字体行高
                      },
                      textAlign: "auto", //整体（包括 text 和 subtext）的水平对齐
                      textVerticalAlign: "auto", //整体（包括 text 和 subtext）的垂直对齐
                      //padding:0,//[5,10] | [ 5,6, 7, 8] ,标题内边距
                      left: "22%", //'5' | '5%'，title 组件离容器左侧的距离
                      right: "auto", //'title 组件离容器右侧的距离
                      top: "2%", //title 组件离容器上侧的距离
                      bottom: "auto", //title 组件离容器下侧的距离
                    },
                    tooltip: {
                      trigger: "item",
                      showDelay: 0,
                      transitionDuration: 0.2,
                    },
                    dataRange: {
                      show: true,
                      min: 0,
                      max: 15,
                      text: ["高", "低"],
                      realtime: true,
                      calculable: true,
                      color: ["orangered", "yellow", "green"],
                      textStyle: {
                        color: "#fff",
                      },
                    },
                    series: [
                      {
                        name: "AQI超标数量",
                        type: "map",
                        map: "中华人民共和国",
                        mapLocation: {
                          y: 60,
                        },
                        zoom: 1.3, //当前视角的缩放比例
                        itemSytle: {
                          emphasis: { label: { show: false } },
                        },
                        label: {
                          normal: {
                            show: true, //是否显示标签
                            textStyle: {
                              color: "#000",
                              fontSize: 10,
                            },
                          },
                          emphasis: {
                            textStyle: {
                              color: "#000",
                            },
                          },
                        },
                        top: "35%",
                        data: list,
                      },
                    ],
                  };
                  chartMidMap.setOption(optionMidMap);
            }
        })
    }
    
    mapFunc()

    setInterval(() => {
        mapFunc()
    }, 5000);

  }
);
